package eight;

public class StaticBlock {
    static{
        System.out.println("静态块");
    }
    StaticBlock(){
        System.out.println("构造方法");
    }
}
class StaticDemo1 {
    public static void main(String[] args) {
        StaticBlock o4 = new StaticBlock(); //加载类时自动执行静态块，一个类只被加载一次，所以静态块也只执行一次
        StaticBlock o5 = new StaticBlock();
        StaticBlock o6 = new StaticBlock();
    }
}

